//
//  Message.swift
//  JiaoZiTaxi
//
//  Created by Hu Gang on 2022/10/12.
//

import Foundation

struct Message: Codable,Equatable,Identifiable {
  var id = UUID()
  let createAt: Double?
  let image: Media?
  let sender: Member
  let text: String?
  let type: MessageType
  let voice: String?
  let video: Media?
  let url:String?
  let phraseCode: String?

  enum MessageType: String,Codable,Equatable {
    case text
    case image
    case voice
    case video
  }
}

extension Message {
  static let all:[Message] = [
    Message(createAt: 1559535000,
            image: nil,
            sender: Member.demo,
            text: "请问在哪里去接您方便？",
            type: .text,
            voice: nil,
            video: nil,
            url:nil,
            phraseCode: nil)
  ]
}
